package practice1_100;

public class Practice83 {
    public ListNode deleteDuplicates(ListNode head) {
//        ListNode falseHead=new ListNode();
        if(head==null||head.next==null) return head;
        ListNode headTemp=head,rearTemp=head;
        while (rearTemp!=null){
            if(rearTemp.val==headTemp.val){
                rearTemp=rearTemp.next;
                headTemp.next=rearTemp;
            }else {
                headTemp=rearTemp;
                rearTemp=rearTemp.next;
            }

        }
        return  head;
    }
}
